$(function(){
    $('#btnxz').click(function(){
        window.location.href="/user/CreateIndex";
    })
    $('#btnqx').click(function(){
        window.location.href="/user/Index";
    })
    $('#btnbc').click(function(){
        console.log('1');
        let id = $('[name=id]').val();
        let productName = $('[name=ProductName]').val();
        let supplier = $('[name=Supplier]').val();
        let price = $('[name=Price]').val();
        let stock = $('[name=Stock]').val();
        let remarks = $('[name=Remarks]').val();
        let obj ={
            id,
            productName,
            supplier,
            price,
            stock,
            Remarks:remarks,
        }
        $.post('/user/save',obj,function(){
            window.location.href="/user/index";
        })

    })
    $('#btncz').click(function(){
        console.log('1');
        let text = $('[name=text]').val();
        window.location.href=`/user/index/${text}`
    })
})
function btnbj(id)
{
    console.log('1');
    window.location.href=`/user/createindex/${id}`;

}
function btnsc(id)
{
    console.log('1');
    let msg = "确认删除？";
    if (confirm(msg)) {
        window.location.href=`/user/delete/${id}`

    }
}